package com.chen.spikemall.repository;

import com.chen.spikemall.bean.CommonGoods;
import com.chen.spikemall.redis.RedisCommonComponent;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class GoodsRepository {

    @Autowired
    private RedisCommonComponent redisCommonComponent;

    Gson gson = new Gson();

    public void save(CommonGoods commonGoods) {
        String json = gson.toJson(commonGoods);
        redisCommonComponent.set(commonGoods.getGoodsNo(), json);
    }

}
